/*
    XTU OJ: 1251
    by: fifth_light
*/

#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

int is_colombian_number(int64_t number) {
    for (int i = 1; i <= 81; i++) {
        int64_t num = number - i;
        if (num <= 0) {
            break;
        }
        int64_t sum = 0;
        for (int exp = 1, i = 0; i < 9; exp *= 10, i++) {
            int64_t n = num / exp % 10;
            sum += n;
        }
        if (sum + num == number) {
            return 0;
        }
    }
    return 1;
}

int main(void) {
    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; i++) {
        int64_t num;
        scanf("%" SCNd64, &num);
        puts(is_colombian_number(num) ? "Yes" : "No");
    }
    return 0;
}
